//
//  SAExpirationPaymentVC.m
//  saasRetail
//
//  Created by mac on 2023/6/25.
//

#import "SAExpirationPaymentVC.h"
#import "SAGrowthCreateOrderAPI.h"

@interface SAExpirationPaymentVC ()<HTTPAPIDelegate>

@property (nonatomic, strong) UIImageView *topImageV;
@property (nonatomic, strong) UIView *topBgView;
@property (nonatomic, strong) UIButton *backBtn;
@property (nonatomic, strong) UIButton *priceBtn;

@property (nonatomic, strong) UILabel *dateLab;
@property (nonatomic, strong) UILabel *illustrateLab;
@property (nonatomic, strong) UIButton *payBtn;

@property (nonatomic, strong) SAGrowthCreateOrderAPI *growthCreateOrderAPI;

@end

@implementation SAExpirationPaymentVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

#pragma mark - HTTPAPIDelegate
- (void)fetchData:(id)data fromServerSuccessedWithAPI:(HTTPAPI *)api {
    if (self.growthCreateOrderAPI == api) {
        NSLog(@"");
    }
}

- (void)fetchDataFromServerFailedWithError:(NSError *)error API:(HTTPAPI *)api {
   
}


#pragma mark - initUI
-(void)initUI {
    
    [self.view addSubview:self.topBgView];
    [self.view addSubview:self.topImageV];
    [self.view addSubview:self.backBtn];
    [self.view addSubview:self.priceBtn];
    [self.view addSubview:self.dateLab];
    [self.view addSubview:self.illustrateLab];
    [self.view addSubview:self.payBtn];
    
//    self.growthCreateOrderAPI.growthServiceId = 1;
//    [self.growthCreateOrderAPI sendRequestToServerWithActivityViewAndMask:POST];
}

-(UIImageView *)topImageV {
    if (!_topImageV) {
        _topImageV = [[UIImageView alloc] initWithFrame:SARectMake(0, 0, 375, 143 + DifferenceHeight)];
        _topImageV.image = [UIImage imageNamed:@"SAExpiration_top2"];
    }
    return _topImageV;
}

-(UIView *)topBgView {
    if (!_topBgView) {
        _topBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 45)];
        _topBgView.backgroundColor = kColor(248, 112, 79, 1);
    }
    return _topBgView;
}

- (UIButton *)backBtn
{
    if (!_backBtn) {
        _backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_backBtn setImage:[UIImage imageNamed:@"whiteAllow"] forState:UIControlStateNormal];
        [_backBtn addTarget:self action:@selector(backToLastVC) forControlEvents:UIControlEventTouchUpInside];
        _backBtn.titleLabel.font = kFont(18);
        _backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _backBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
        _backBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
        _backBtn.frame = SARectMake(0, DifferenceHeight + 20, 50, 44);
    }
    return _backBtn;
}

-(UIButton *)priceBtn {
    if (!_priceBtn) {
        _priceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_priceBtn setImage:[UIImage imageNamed:@"SATrial_￥"] forState:UIControlStateNormal];
        _priceBtn.titleLabel.font = kBFont(45);
        [_priceBtn setTitleColor:kBlackColor forState:UIControlStateNormal];
        [_priceBtn setTitle:@"168元/年" forState:UIControlStateNormal];
        _priceBtn.frame = SARectMake(0, DifferenceHeight + 200, kBaseScreenWidth, 50);
        _priceBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        _priceBtn.userInteractionEnabled = NO;
    }
    return _priceBtn;
}

-(UILabel *)dateLab {
    if (!_dateLab) {
        _dateLab = [[UILabel alloc] initWithFrame:SARectMake(70, DifferenceHeight + 300, kBaseScreenWidth - 70, 20)];
        _dateLab.text = @"注册时间：2023-06-12";
        _dateLab.font = kBFont(20);
        _dateLab.textColor = kBlackColor;
    }
    return _dateLab;
}

-(UILabel *)illustrateLab {
    if (!_illustrateLab) {
        _illustrateLab = [[UILabel alloc] initWithFrame:SARectMake(70, DifferenceHeight + 340, kBaseScreenWidth - 70, 20)];
        _illustrateLab.text = @"到期时间：2024-06-12";
        _illustrateLab.font = kBFont(20);
        _illustrateLab.textColor = kBlackColor;
    }
    return _illustrateLab;
}

-(UIButton *)payBtn {
    if (!_payBtn) {
        _payBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_payBtn setBackgroundImage:[UIImage imageNamed:@"SATrial_payment"] forState:UIControlStateNormal];
        _payBtn.frame = CGRectMake((kScreenWidth - kScaleNum(200))/2, kScreenHeight - kScaleNum(120), kScaleNum(200), kScaleNum(60));
    }
    return _payBtn;
}

-(SAGrowthCreateOrderAPI *)growthCreateOrderAPI {
    if (!_growthCreateOrderAPI) {
        _growthCreateOrderAPI = [SAGrowthCreateOrderAPI apiWithDelegate:self];
    }
    return _growthCreateOrderAPI;
}

@end
